<script setup>
import {reactive, ref} from "vue";

let parentMessage = ref("产品")
let items = reactive(
    [
      {id:'item1',name:"可乐"},
      {id:'item2',name:"薯片"},
    ]
)
</script>

<template>
  <!--列表渲染语句-->
  <div>
    <ul>
      <li v-for="item in items" :key="item.id">
        {{item.name}}
      </li>
    </ul>

    <ul>
      <li v-for="(item,index) in items" :key="item.id">
          {{parentMessage}} - {{index}} - {{item.name}}
      </li>
    </ul>
  </div>
</template>

<style scoped>

</style>